package com.bzkj.basicinfo.mapper;

import com.bzkj.basicinfo.domain.basic.BasicStoArea;
import com.bzkj.basicinfo.domain.basic.BasicStoAreaRules;
import com.bzkj.basicinfo.domain.ncc.StoArea;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author: Admin
 * @Description: 库区数据访问层接口，定义了库区的基本操作
 */
@Mapper
public interface StoAreaMapper {

    /**
     * 新增剂型
     *
     * @param stoArea 新增的库区对象
     * @return 受影响的记录数
     */
    int insertStoArea(StoArea stoArea);

    int insertFormulationInfo(StoArea stoArea);

    /**
     * 更新库区
     *
     * @param stoArea 更新的库区对象
     * @return 受影响的记录数
     */
    int updateStoArea(StoArea stoArea);

    /**
     * 根据 ID 查询库区
     *
     * @param stoAreaId 库区的唯一标识符
     * @return 查询到的库区对象
     */
    StoArea selectStoAreaById(String stoAreaId);

    /**
     * 通过仓库id和库区id查剂型
     * @param stoId
     * @param stoAreaId
     * @return
     */
    List<StoArea> selectFormulationByStoIdAndAreaId(@Param("stoId")String stoId,@Param("stoAreaId")String stoAreaId);

    /**
     * 通过id查询剂型
     * @param id
     * @return
     */
    StoArea selectFormulationById(@Param("id")String id);
    /**
     * 根据 ID 查询库区
     *
     * @param list 库区的唯一标识符
     * @return 查询到的库区对象
     */
    List<StoArea> selectStoAreaByIds(@Param("list")List<String> list);

    /**
     * 查询所有库区
     *
     * @return 所有库区的列表
     */
    List<StoArea> selectAllStoAreas();

    /**
     * 删除剂型
     *
     * @param id 剂型的唯一标识符
     * @return 受影响的记录数
     */
    int deleteFormulation(@Param("id")String id);

    /**
     * 根据仓库 ID 查询库区列表
     *
     * @param stoId 仓库的唯一标识符
     * @return 与指定仓库关联的库区列表
     */
    List<BasicStoArea> selectStoAreasByWarehouseId(String stoId);


    StoArea selectByStoAreaName(@Param("stoAreaName") String stoAreaName, @Param("def1") String def1);


    List<HashMap> getAddStoUnitById(String sto_id);


    int insertStockMap(Map<String, Object> params);

    List<HashMap<String, Object>> queryStoAreaHouse(@Param("sto_code")String sto_code,@Param("sto_area_code")String sto_area_code);

    Long queryBigNumber();

    int deleteStoAreaRules(@Param("stoAreaId")String stoAreaId);

    Integer selectCountByStoArea();

    String selectDataDic(@Param("UID")int UID);

    void updateStoAreaRule(StoArea stoArea);

    int deleteAreaRulesById(@Param("id") String id);

    List<BasicStoAreaRules> selectAreaRules(@Param("stoAreaId") String stoAreaId);

    List<BasicStoAreaRules> selectAreaRulesByAreaId(@Param("stoAreaId")String stoAreaId);

}
